﻿// JScript 文件

    function btNextClick() 
    {
        if(document.getElementById("txtShopName").value=="")
        {
            alert("请输入店铺名称！");
            return false;
        }
        if (document.getElementById("ddlParentID").length == 0)
        {
             alert("请选择隶属分公司");
             return false;
        }
        
        else
        {        
            document.getElementById("pShopDetail").style.display ="block";
            document.getElementById("pShopMaster").style.display ="none";
            
            if(document.form1.btPre.style.display=="block")
            {   
                return  confirm("确定要保存吗？");
            }
            document.form1.btPre.style.display="block"; 
            return false;
        }
    }
    
    function btPreClick() 
    {
        document.getElementById("pShopDetail").style.display ="none";
        document.getElementById("pShopMaster").style.display ="block";
          
        return false;
    }
    
    function ddlProvinceonChange()
    {
        var index = document.form1.ddlProvince.selectedIndex;  
        var value = document.form1.ddlProvince.options[index].value;

        BLL.CommBLL.GetCity(value,ddlProvinceonChange_callback);
    }

    function txtCustomerNoChange()
    {
        BLL.CustomerBLL.isExitCustomerNo(document.form1.txtCustomerNo.value,txtCustomerNoChange_callback);
    }

    function txtCustomerNoChange_callback(res)
    {
        if(res.value!=0)
        {
            alert("该账号已经存在");
            document.form1.txtCustomerNo.value="";
        }
    }
    
    function ddlProvinceonChange_callback(res)
    {
        var dt = res.value;  
        document.form1.ddlCity.length=0;
        for(var i=0; i<dt.Rows.length; i++)
            {
                var name=dt.Rows[i]["Name"];             
                var id=dt.Rows[i]["ID"];
                
               document.form1.ddlCity.options.add(new Option(name,id));
            }
    }